<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>商品信息修改</title>
	<!-- 公共样式 开始 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/base.css">
	<link rel="stylesheet" type="text/css" href="Resources/css/iconfont.css">
	<script type="text/javascript" src="Resources/framework/jquery-1.11.3.min.js"></script>
	<link rel="stylesheet" type="text/css" href="Resources/layui/css/layui.css">
	<script type="text/javascript" src="Resources/layui/layui.js"></script>
	<!-- 滚动条插件 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/jquery.mCustomScrollbar.css">
	<script src="Resources/framework/jquery-ui-1.10.4.min.js"></script>
	<script src="Resources/framework/jquery.mousewheel.min.js"></script>
	<script src="Resources/framework/jquery.mCustomScrollbar.min.js"></script>	
	<script type="text/javascript" src="Resources/js/check.js"></script>
</head>
<body>
	<div class="cBody">
		<div class="console">
			<form class="layui-form" action="listProduct?status=selectlike" method="post">
				<input type="hidden" name="page" value="back">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input type="text" name="key" required lay-verify="required" placeholder="输入商品名称" autocomplete="off" class="layui-input">
					</div>
					<button class="layui-btn" lay-submit lay-filter="formDemo">检索</button>
					<a class="layui-btn" onclick="deleteall('listProduct?status=deletequery&ids=');" href="#">批量删除</a>
				</div>
			</form>

		</div>
			
		<table class="layui-table">
			<thead>
				<tr>
					<th></th>
					<th>商品ID</th>
					<th>商品名</th>
					<th>图片</th>
					<th>分类</th>
					<th>详情</th>
					<th>价格</th>
					<th>库存</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${products}" var="Good" varStatus="st">
			   		<tr>
			   			<td><input type="checkbox" name="child" value="${Good.gid}" onclick="chickchild();"></td>
			            <td>${Good.gid}</td>
			            <td>${Good.gName}</td>
			            <td>
				            <img src="${Good.gsrc}" width="120" height="100" onmouseenter="imgBig(this)" onmouseleave="imgSmall(this)">	
			            </td>
			            <td>${Good.cateName }</td>
			            <td>${Good.gMsg }</td>
			            <td>${Good.gPrice}</td>
			            <td >${Good.gnum}</td>
			            <td>
							<button class="layui-btn layui-btn-xs" onclick="updateBut('${Good.gid}')">修改</button>
							<button class="layui-btn layui-btn-xs" onclick="location.href='listProduct?status=delete&gid=${Good.gid}'">删除</button>
						</td>
			        </tr>
				</c:forEach>
			</tbody>
			<thead>
					<tr>
					<td colspan="12">
						<input type="checkbox" id="checkAll" name="checkAll" onclick="selectAll();">全选&emsp;&emsp;
						<input type="checkbox" id="recheck" onclick="notSelectAll()">反选
						<div align="center">
							<a href="listProduct?status=selectall&start=0">首页</a>&emsp;
							<a href="listProduct?status=selectall&status=selectpage&start=${prePage}">前一页</a>&emsp;
							<a href="listProduct?status=selectall&status=selectpage&start=${nextPage}">后一页</a>&emsp;
							<a href="listProduct?status=selectall&status=selectpage&start=${totalPage-1}">尾页</a>&emsp;
						</div>
						<div align="center"> 
							当前记录数:${star}&emsp;总记页数：${totalPage}&emsp;总记录数：${totalsize}
						</div>
					</td>
				</tr>
				</thead>
		</table>
			
			<!-- layUI 分页模块 -->
		<div id="pages"></div>
		<script>
			//修改按钮
			var updateFrame = null;
			function updateBut(gid){
				layui.use('layer', function() {
					var layer = layui.layer;
						
					//iframe层-父子操作
					updateFrame = layer.open({
                   		title: "商品信息修改",
						type: 2,
						area: ['70%', '60%'],
						scrollbar: false,	//默认：true,默认允许浏览器滚动，如果设定scrollbar: false，则屏蔽
						maxmin: true,
						content: 'listProduct?status=Goodinfo&id='+gid
					});
				});
				
			}
		</script>
	</div>
</body>
</html>